<template>
	<!-- 直接从首页进入时生效  消息推送不生效 -->
	<view class="start-up">
		<image src="../../static/images/imgs/start-up.png" mode="scaleToFill"></image>
		<view class="start-up-position-bottom">
			<u-line-progress :percent="percentNow" height='14' :show-percent='false'></u-line-progress>
		</view>
	</view>
</template>

<script>
	import { getUrlParam, getAuth } from '@/common/js/common.js'
	import { mapActions } from 'vuex'
	export default {
		data(){
			return{
				percentNow:10,
				timerId: null
			}
		},
		async onLoad(){
			this.initTimer()
			await this.$onLaunched;
			this.percentNow = 100
			this.initData()
		},
		methods: {
			initTimer(){
				this.timerId = setInterval(()=>{
					if(this.percentNow>89){
						this.percentNow = this.percentNow + 3
					}else{
						this.percentNow = this.percentNow + 10
					}
					if(this.percentNow>97){
						clearInterval(this.timerId)
						this.timerId = null
					}
				},500)
			},
			initData(){
				uni.redirectTo({
					url:'/pages/Index'
				})
			},
		},
		destroyed() {
			if(this.timerId){
				clearInterval(this.timerId)
				this.timerId = null
			}
		}
	}
</script>

<style lang="scss" scoped>
	.start-up{
		height: calc(100vh);
		width: calc(100vw);
		position: relative;
		>image{
			height: 100%;
			width: 100%;
		}
		&-position-bottom{
			position: absolute;
			width: calc(100vw - 60rpx);
			left: 30rpx;
			bottom: 80rpx;
		}
	}
</style>